﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage_user.master" AutoEventWireup="true" CodeFile="insertQLSanPham.aspx.cs" Inherits="insertQLSanPham" %>

<asp:Content ID="Content1" ContentPlaceHolderID="user_content" Runat="Server">
    <script src="./javascripts/t_js.js"></script>
    <div id="quanlysanpham">
    <div class="title">Quản Lý Sản Phẩm</div>
    <div class="featureUpload">
    
    <div class="upload1">
        <ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadError="uploadError"
        OnClientUploadStarted="StartUpload" 
        OnClientUploadComplete="UploadComplete" CompleteBackColor="Lime"
        ErrorBackColor="Red" ThrobberID="Throbber" OnUploadedComplete="AsyncFileUpload1_UploadedComplete"
        UploadingBackColor="#66CCFF" /></div>
   
    <div class="upload2">
         <asp:Label ID="Label7" runat="server" Text="Tải ảnh lên:" Font-Bold="True" 
            Font-Names="Arial" ForeColor="#507CD1"></asp:Label>&nbsp;
    </div>
    </div>

    <div class="messageReport">
        <asp:Label ID="Throbber" runat="server" Style="display: none" ClientIDMode="Static">
        <img src="Images/indicator.gif" alt="" />
        </asp:Label>
        <asp:Label ID="lblStatus" runat="server" Font-Names="Arial" ForeColor="#507CD1"
            ClientIDMode="Static" Text=""></asp:Label>
    </div>
    <br />
    <%--ClientIDMode="Static" để javascript ở client có thể nhận ra--%>

    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        CellPadding="4" Font-Names="Arial" GridLines="None" Height="50px" 
        HorizontalAlign="Center" 
        onpageindexchanging="DetailsView1_PageIndexChanging" DefaultMode="Insert" 
        DataSourceID="SqlDataSource1" CssClass="tableView">
        <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <EditRowStyle BackColor="#507CD1" />
        <FieldHeaderStyle BackColor="#99CCFF" Font-Bold="True" ForeColor="White" 
            HorizontalAlign="Left" VerticalAlign="Middle" />
        <Fields>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    &nbsp;
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Thêm" />
                    &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Hủy" />
                    &nbsp;<asp:Button ID="btQuayLai" runat="server" onclick="btQuayLai_Click" 
                        Text="Quay lại" />
                </InsertItemTemplate>
                <ItemTemplate>
                    &nbsp;&nbsp;
                </ItemTemplate>
                <ItemStyle BackColor="#99CCFF" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mã Shop" SortExpression="Mashop">
                <InsertItemTemplate>
                    <asp:DropDownList ID="dlMaShop" runat="server" DataSourceID="SqlDataSource2" 
                        DataTextField="Tenshop" DataValueField="Mashop" 
                        SelectedValue='<%# Bind("mashop") %>'>
                    </asp:DropDownList>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tên Sản Phẩm" SortExpression="Tensanpham">
                <InsertItemTemplate>
                    <asp:TextBox ID="txtTenSP" runat="server" Text='<%# Bind("tensp") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Loại Sản Phẩm" SortExpression="loaisanpham">
                <InsertItemTemplate>
                    <asp:DropDownList ID="dlLoaiSP" runat="server" DataSourceID="SqlDataSource3" 
                        DataTextField="Tenloai" DataValueField="Maloaisanpham" 
                        SelectedValue='<%# Bind("loaisp") %>'>
                    </asp:DropDownList>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="URL" SortExpression="URL">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Width="477px" Text='<%# Bind("url") %>' ClientIDMode="Static"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Giá" SortExpression="giasanpham">
                <InsertItemTemplate>
                    <asp:TextBox ID="txtGia" runat="server" Text='<%# Bind("giasp") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mô Tả" SortExpression="Mota">
                <InsertItemTemplate>
                    <asp:TextBox ID="txtMoTa" runat="server" Height="269px" TextMode="MultiLine" 
                        Width="552px" Text='<%# Bind("mota") %>' ></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
        </Fields>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" 
            HorizontalAlign="Center" VerticalAlign="Middle" />
        <PagerStyle ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
    </asp:DetailsView>
    </div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:chodientuConnectionString %>" 
        InsertCommand="sp_ThemSanPham" InsertCommandType="StoredProcedure" 
        SelectCommand="SELECT * FROM [Sanpham]">
        <InsertParameters>
            <asp:Parameter Name="mashop" Type="String" />
            <asp:Parameter Name="tensp" Type="String" />
            <asp:Parameter Name="loaisp" Type="String" />
            <asp:Parameter Name="url" Type="String" />
            <asp:Parameter Name="giasp" Type="Double" />
            <asp:Parameter Name="mota" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:chodientuConnectionString %>" 
        SelectCommand="SELECT * FROM [Shop] WHERE ([Username] = @Username)">
        <SelectParameters>
            <asp:SessionParameter Name="Username" SessionField="User" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:chodientuConnectionString %>" 
        SelectCommand="SELECT * FROM [Loaisanpham]"></asp:SqlDataSource>
</asp:Content>

